package org.huangrui.spark.scala.sql

import org.apache.spark.sql.{Dataset, Row, SaveMode, SparkSession}

/**
 * @Author hr
 * @Create 2024-10-20 20:11 
 */
object SparkSQL06_Source_Parquet {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder().appName("SparkSQL06_Source_Parquet").master("local[2]").getOrCreate()

    spark.read.parquet("data/users.parquet").show()
    val json = spark.read.json("data/user.json")

    json.write.mode(SaveMode.Overwrite).parquet("output")
    json.write.mode(SaveMode.Append).csv("output")
    spark.stop()
  }
}
